package com.sg.service.biz.pbff.nb;

import cn.hutool.core.util.ObjectUtil;
import com.sg.dto.integration.framework.BizSceneDto;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author ： 手工接入方法
 * @version 1.0
 * @since 2022/5/28 15:32
 */
@Service
public class NbAppScene {
    /**
     * code:collectionRemoveExistingData
     * name:查询宿主类型可推荐业务场景列表（特殊方法）
     * desc:undefined
     * gen by moon at 2022/7/4 下午6:49:54
     **/
    @Trace(operationName = "查询宿主类型可推荐业务场景列表（特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public QueryHostTypeCollectionRemoveExistingDataListRespDto queryHostTypeCollectionRemoveExistingDataList(QueryHostTypeCollectionRemoveExistingDataListReqDto reqDto) {
        // TODO ruizhe skai dong ; 2022/7/4 下午6:49:54
        QueryHostTypeCollectionRemoveExistingDataListRespDto retData = new QueryHostTypeCollectionRemoveExistingDataListRespDto();
        List<BizSceneDto> filterData = new ArrayList<>(reqDto.getBizSceneList());
        Map<String, BizSceneDto> sceneIndex = new HashMap<>();
        for (BizSceneDto scene : reqDto.getBizSceneList()) {
            sceneIndex.put(scene.getBizSceneId(), scene);
        }
        for (String one : reqDto.getHostTypeBizScnList()) {
            BizSceneDto waiteDel = sceneIndex.get(one);
            if (!ObjectUtil.isEmpty(waiteDel)) {
                filterData.remove(waiteDel);
            }
        }
        retData.setBizSceneList(filterData);
        return retData;
    }
    //手工接入方法
}
